不重启abaqus,调试abaqus GUI界面,qycache开发环境的搭建

您所在的位置:网站首页 abaqus gui开发 中文 不重启abaqus,调试abaqus GUI界面,qycache开发环境的搭建

不重启abaqus,调试abaqus GUI界面,qycache开发环境的搭建

2024-06-14 03:04| 来源: 网络整理| 查看: 265

#搭建abaqus GHI脚本开发环境的方法 1、PrototypeToolsetGui.py 头部文件 import label_Directory_plugin 改变 初始化函数__init__中 self.form = test_plugin.Test_plugin(self) 改变onCmdForm()函数中 reload(test_plugin) self.form = test_plugin.Test_plugin(self) 将test_plugin和Test_plugin改变为自己脚本中的plugin文件 2、改变自己脚本的注册文件plugin.py

#改变初始函数 def __init__(self, owner): self.cmd = AFXGuiCommand(mode=self, method='label_print', objectName='func1', registerQuery=False) #在getFirstDialog中增加 reload(label_DirectoryDB) def getFirstDialog(self): import label_DirectoryDB reload(label_DirectoryDB) return label_DirectoryDB.Label_DirectoryDB(self)

3、注释Register the plug-in下面部分的代码

qycache脚本文件: 以下代码来源于abaqus官方文档 prototypeMainWindow.py

""" This script will create the prototype application main window. """ from abaqusGui import * from sessionGui import * from canvasGui import CanvasToolsetGui from viewManipGui import ViewManipToolsetGui from prototypeToolsetGui import PrototypeToolsetGui ########################################################################### # Class definition ########################################################################### class PrototypeMainWindow(AFXMainWindow): #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __init__(self, app, windowTitle=''): # Construct the GUI infrastructure. # AFXMainWindow.__init__(self, app, windowTitle) # Register the "persistent" toolsets. # self.registerToolset(FileToolsetGui(), GUI_IN_MENUBAR|GUI_IN_TOOLBAR) self.registerToolset(ModelToolsetGui(), GUI_IN_MENUBAR) self.registerToolset(CanvasToolsetGui(), GUI_IN_MENUBAR) self.registerToolset(ViewManipToolsetGui(), GUI_IN_MENUBAR|GUI_IN_TOOLBAR) self.registerToolset(PrototypeToolsetGui(), GUI_IN_MENUBAR|GUI_IN_TOOLBOX) self.registerHelpToolset(HelpToolsetGui(), GUI_IN_MENUBAR|GUI_IN_TOOLBAR) # Register modules. # self.registerModule('Part', 'Part') self.registerModule('Property', 'Property') self.registerModule('Assembly', 'Assembly') self.registerModule('Step', 'Step') self.registerModule('Interaction', 'Interaction') self.registerModule('Load', 'Load') self.registerModule('Mesh', 'Mesh') self.registerModule('Job', 'Job') self.registerModule('Visualization', 'Visualization') self.registerModule('Sketch', 'Sketch')

prototypeApp.py

""" This script will create the prototype application. """ from abaqusGui import * import sys from prototypeMainWindow import PrototypeMainWindow # Initialize the application object. # app = AFXApp('ABAQUS/CAE', 'ABAQUS, Inc.') app.init(sys.argv) # Construct the main window. # PrototypeMainWindow(app) # Create the application and run it. # app.create() app.run()

applcons.py

""" This module defines icons used for the prototype application. """ dialogIconData = [ "24 24 2 1", " c navy", "X c None s None", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXX XXXXXXXXX", "XXX XXXXXXX", "XXX XXXXXX", "XXX XXXXXX XXXXX", "XXX XXXXXXX XXXX", "XXX XXXXXXXX XXXX", "XXX XXXXXXXX XXXX", "XXX XXXXXXXXX XXX", "XXX XXXXXXXXX XXX", "XXX XXXXXXXXX XXX", "XXX XXXXXXXXX XXX", "XXX XXXXXXXXX XXX", "XXX XXXXXXXXX XXX", "XXX XXXXXXXX XXXX", "XXX XXXXXXXX XXXX", "XXX XXXXXXX XXXX", "XXX XXXXXXX XXXXX", "XXX XXXXXX", "XXX XXXXXXX", "XXX XXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", ] formIconData = [ "24 24 2 1", " c navy", "X c None s None", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXX XXXXX", "XXXX XXXXX", "XXXX XXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXX", "XXXX XXXXXXX", "XXXX XXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXX XXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", "XXXXXXXXXXXXXXXXXXXXXXXX", ]

prototypeToolsetGui.type

from abaqusGui import * from appIcons import * import testForm ########################################################################### # Class definition ########################################################################### class PrototypeToolsetGui(AFXToolsetGui): [ ID_FORM, ] = range(AFXToolsetGui.ID_LAST, AFXToolsetGui.ID_LAST+1) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __init__(self): # Construct the base class. # AFXToolsetGui.__init__(self, 'Test Toolset') FXMAPFUNC(self, SEL_COMMAND, self.ID_FORM, PrototypeToolsetGui.onCmdForm) self.form = testForm.TestForm(self) # Toolbox buttons # group = AFXToolboxGroup(self) formIcon = FXXPMIcon(getAFXApp(), formIconData) AFXToolButton(group, '\tReload Form', formIcon, self, self.ID_FORM) dialogIcon = FXXPMIcon(getAFXApp(), dialogIconData) self.dialogBtn = AFXToolButton(group, '\tPost Dialog', dialogIcon, self.form, AFXMode.ID_ACTIVATE) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def onCmdForm(self, sender, sel, ptr): # Reload the form module and reconstruct the form so that any # changes to that module are updated. # reload(testForm) self.form = testForm.TestForm(self) self.dialogBtn.setTarget(self.form) getAFXApp().getAFXMainWindow().writeToMessageArea( 'The form has been reloaded.') return 1

testForm.py

from abaqusGui import * import testDB # Note: The above form of the import statement is used for the prototype # application to allow the module to be reloaded while the application is # still running. In a non-prototype application you would use the form: # from myDB import MyDB ########################################################################### # Class definition ########################################################################### class TestForm(AFXForm): #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __init__(self, owner): # Construct the base class. # AFXForm.__init__(self, owner) # Command # self.cmd = AFXGuiCommand(self, 'myCommand', 'myObject') self.kw1 = AFXStringKeyword(self.cmd, 'kw1', TRUE) self.kw2 = AFXIntKeyword(self.cmd, 'kw2', TRUE) self.kw3 = AFXFloatKeyword(self.cmd, 'kw3', TRUE) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def getFirstDialog(self): # Note: The style below is used for the prototype application to # allow the dialog to be reloaded while the application is # still running. In a non-prototype application you would use: # # return MyDB(self) # Reload the dialog module so that any changes to the dialog # are updated. # reload(testDB) return testDB.TestDB(self) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def issueCommands(self): # Since this is a prototype application, just write the command to # the Message Area so it can be visually verified. If you have # defined a "real" command, then you can comment out this method to # have the command issued to the kernel. # # In a non-prototype application you normally do not need to write # the issueCommands() method. # cmds = self.getCommandString() getAFXApp().getAFXMainWindow().writeToMessageArea(cmds) self.deactivateIfNeeded() return TRUE

testDB.py

from abaqusGui import * ########################################################################### # Class definition ########################################################################### class TestDB(AFXDataDialog): #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def __init__(self, form): # Construct the base class. # AFXDataDialog.__init__(self, form, 'Test Dialog', self.OK|self.CANCEL, DECOR_RESIZE|DIALOG_ACTIONS_SEPARATOR) # Create the contents of the dialog # va = AFXVerticalAligner(self) AFXTextField(va, 10, 'String:', form.kw1, 0) AFXTextField(va, 10, 'Integer:', form.kw2, 0) AFXTextField(va, 10, 'Float:', form.kw3, 0) #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ def show(self): # Note: This method is only necessary because the prototype # application allows changes to be made in the dialog code and # reloaded while the application is still running. Normally you # would not need to have a show() method in your dialog. # Resize the dialog to its default dimensions to account for # any widget changes that may have been made. # self.resize(self.getDefaultWidth(), self.getDefaultHeight()) AFXDataDialog.show(self)


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3